set more off

use "NES1996 (raw).dta"


**********Dependent Variable: Vote Choice****************
gen vote = .
replace vote = 1 if V961082 == 2
replace vote = 0 if V961082 == 1
label var vote "Vote Choice" 
label def vot 1 "Dole" 0 "Clinton"
label values vote vot

********Knowledge for Proximity Variables*****
	foreach var in 	V961189 	V961190 	V961191 	V961192 {
		codebook `var' 
		tab `var'
		}
		*0 = Inap, no post iw
		*1 = correct
		*5 = incomplete/wrong
		*8 = dk
		*9 = na
		*recode: 1 = correct; 0 = incorrect/no guess
label def corre 1 "Correct" 0 "Incorrect/No Guess"
recode V961189 (0=.) (1=1) (5=0) (8=0) (9=.), gen(gore)
recode V961190 (0=.) (1=1) (5=0) (8=0) (9=.), gen(rein)
recode V961191 (0=.) (1=1) (5=0) (8=0) (9=.), gen(yelt)
recode V961192 (0=.) (1=1) (5=0) (8=0) (9=.), gen(ging)
	foreach var in gore rein yelt ging {
		label values `var' corre
		tab `var'
		}
recode V961072 (1=0) (5=1) (0=.) (8=0) , gen(house)
recode V961073 (1=0) (5=1) (0=.) (8=0) (9=.), gen(senate)
label values house corre
label values senate corre
tab house 
tab senate		

		
egen knowl = rowtotal(gore rein yelt ging house senate), missing
label var knowl "Pol. Knowledge"
tab knowl
summ knowl, detail
	*Median = 4; range: 0-6


**********Main Ind. Variable: Policy Attitude, Importance, Proximity****************

***services***
*own attitude and candidate placement*
gen spend96 = .
replace spend96 = 1 if V960450 == 7
replace spend96 = 2 if V960450 == 6
replace spend96 = 3 if V960450 == 5
replace spend96 = 4 if V960450 == 4
replace spend96 = 5 if V960450 == 3
replace spend96 = 6 if V960450 == 2
replace spend96 = 7 if V960450 == 1

gen clintonspend96 = . 
replace clintonspend96 = 1 if V960453 == 7
replace clintonspend96 = 2 if V960453 == 6
replace clintonspend96 = 3 if V960453 == 5
replace clintonspend96 = 4 if V960453 == 4
replace clintonspend96 = 5 if V960453 == 3
replace clintonspend96 = 6 if V960453 == 2
replace clintonspend96 = 7 if V960453 == 1

gen dolespend96 = .
replace dolespend96 = 1 if V960455 == 7
replace dolespend96 = 2 if V960455 == 6
replace dolespend96 = 3 if V960455 == 5
replace dolespend96 = 4 if V960455 == 4
replace dolespend96 = 5 if V960455 == 3
replace dolespend96 = 6 if V960455 == 2
replace dolespend96 = 7 if V960455 == 1

label def spen 1 "No Reduction in Spending" 7 "Provide Many Fewer Services"
label values dolespend96 spen
label values clintonspend96 spen
label values spend96 spen

*Proximity*
	*City Block
		*Sample Placement
			summarize clintonspend96 dolespend96
			*clinton: 3.089253
			*dole: 4.853581

			gen spend96prox = abs(spend96 - 3.089253) - abs(spend96 - 4.853581)
		*Informed Placement
			summarize clintonspend96 dolespend96 if knowl >=5 & knowl <= 6
				*clinton: 2.836842
				*dole: 5.112701
			gen spend96prox_info = abs(spend96 - 2.836842) - abs(spend96 - 5.112701)
			
		*Self-Placemnet
			gen spend96prox_self = abs(spend96 - clintonspend96) - abs(spend96 - dolespend96)
		
	*Euclidean
			gen spend96prox_euclid1 = [(spend96 - 3.089253) * (spend96 - 3.089253)] - [(spend96 - 4.853581) * (spend96 - 4.853581)]
			gen spend96prox_euclid2 = [(spend96 - 2.836842) * (spend96 - 2.836842)] - [(spend96 - 5.112701) * (spend96 - 5.112701)]
			gen spend96prox_euclid3 = [(spend96 - clintonspend96) * (spend96 - clintonspend96)] - [(spend96 - dolespend96) * (spend96 - dolespend96)]
			
	*Summary Stats
		summ spend96prox spend96prox_info spend96prox_self spend96prox_euclid1 spend96prox_euclid2 spend96prox_euclid3


*attitude strength*
gen spend96ext = . 
replace spend96ext = 1 if spend96 == 4
replace spend96ext = 2 if spend96 == 3
replace spend96ext = 2 if spend96 == 5
replace spend96ext = 3 if spend96 == 2
replace spend96ext = 3 if spend96 == 6
replace spend96ext = 4 if spend96 == 1
replace spend96ext = 4 if spend96 == 7
label var spend96ext "Spending: Extremity"

gen spend96certain = . 
replace spend96certain = 1 if V960451 == 3
replace spend96certain = 2 if V960451 == 2
replace spend96certain = 3 if V960451 == 1
label def cert 1 "Not Very Certain" 2 "Pretty Certain" 3 "Very Certain"
label values spend96certain cert

gen spend96imp = . 
replace spend96imp = 1 if V960452 == 5
replace spend96imp = 2 if V960452 == 4
replace spend96imp = 3 if V960452 == 3
replace spend96imp = 4 if V960452 == 2
replace spend96imp = 5 if V960452 == 1
label def imp 1 "Not Imp at All" 3 "Somewhat Important" 5 "Extremely Important" 
label values spend96imp imp


*standardization*

foreach var in  spend96prox spend96prox_info spend96prox_self spend96prox_euclid1 spend96prox_euclid2 spend96prox_euclid3 spend96ext spend96imp spend96certain {
		qui sum `var'
		gen `var'01 = (`var' - `r(min)') / (`r(max)'-`r(min)')
	}
	
	
label var spend96prox01 "Spend:Prox"
label var spend96imp01 "Spend:Imp"


***defense***
*own attitude and candidate placement*
rename V960463 defense96 
rename V960466 clintondefense96
rename V960469 doledefense96
mvdecode defense96 doledefense96 clintondefense96 , mv(0 = . \ 8 = . \ 9 = .)
label def def 1 "Greatly Decrease" 7 "Greatly Increase"
label values defense96 def
label values clintondefense96 def
label values doledefense96 def


*proximity*
	*City Block: sample
		summarize clintondefense96 doledefense96
		*clinton: 3.946271
		*dole: 4.653586

		gen defense96prox = abs(defense96 - 3.946271) - abs(defense96 - 4.653586)
	*City block: informed
		summarize clintondefense96 doledefense96 if knowl >=5 & knowl <= 6
		*clinton:  3.552773
		*dole: 4.959259
		gen defense96prox_info = abs(defense96 - 3.552773) - abs(defense96 - 4.959259)
	*city block: Self
		gen defense96prox_self = abs(defense96 - clintondefense96) - abs(defense96 - doledefense96)
	
	*Euclidean
		gen defense96prox_euclid1 = [(defense96 - 3.946271)*(defense96 - 3.946271)] - [(defense96 - 4.653586)*(defense96 - 4.653586)]
		gen defense96prox_euclid2 = [(defense96 - 3.552773) * (defense96 - 3.552773)] - [(defense96 - 4.959259)* (defense96 - 4.959259)]
		gen defense96prox_euclid3 = [(defense96 - clintondefense96)*(defense96 - clintondefense96)] - [(defense96 - doledefense96)* (defense96 - doledefense96)]
		
	summ defense96prox defense96prox_info defense96prox_self defense96prox_euclid1 defense96prox_euclid2 defense96prox_euclid3
		
	
	

*attitude strength*
gen defense96ext = . 
replace defense96ext = 1 if defense96 == 4
replace defense96ext = 2 if defense96 == 3
replace defense96ext = 2 if defense96 == 5
replace defense96ext = 3 if defense96 == 2
replace defense96ext = 3 if defense96 == 6
replace defense96ext = 4 if defense96 == 1
replace defense96ext = 4 if defense96 == 7

gen defense96certain = .
replace defense96certain = 1 if V960464 == 3
replace defense96certain = 2 if V960464 == 2
replace defense96certain = 3 if V960464 == 1
label values defense96certain cert


gen defense96imp = . 
replace defense96imp = 1 if V960465 == 5
replace defense96imp = 2 if V960465 == 4
replace defense96imp = 3 if V960465 == 3
replace defense96imp = 4 if V960465 == 2
replace defense96imp = 5 if V960465 == 1
label values defense96imp imp



*standardization*

foreach var in defense96prox defense96prox_info defense96prox_self defense96prox_euclid1 defense96prox_euclid2 defense96prox_euclid3 defense96ext defense96imp defense96certain {
		qui sum `var'
		gen `var'01 = (`var' - `r(min)') / (`r(max)'-`r(min)')
	}
	
	
label var defense96prox01 "Defense:Prox"
label var defense96imp01 "Defense:Imp"


**aid to blacks***

*own attitude and candidate placement*
label def baid 1 "Gov't Should Help Blacks" 7 "Blacks Should Help Themselves"
rename V960487  blackaid96
rename V960490 clintonblackaid96
rename V960492 doleblackaid96
label values blackaid96 baid
label values clintonblackaid96 baid
label values doleblackaid96
mvdecode blackaid96 clintonblackaid96 doleblackaid96 , mv(0 = . \ 8 = . \ 9 = .) 

*proximity*
	*City Block: Sample
		summarize clintonblackaid96 doleblackaid96
		*clinton: 3.315755
		*dole: 4.995882

		gen blackaid96prox = abs(blackaid96 - 3.315755) - abs(blackaid96 - 4.995882)

	*City block: Informed
			summarize clintonblackaid96 doleblackaid96 if knowl >=5 & knowl <= 6
			*clinton  3.014706 
			*dole 5.239089
		gen blackaid96prox_info = abs(blackaid96 - 3.014706 ) - abs(blackaid96 - 5.239089)
	*city Block: Self
			gen blackaid96prox_self = abs(blackaid96 - clintonblackaid96 ) - abs(blackaid96 - doleblackaid96)

	*Euclid
		gen blackaid96prox_euclid1 = [(blackaid96 - 3.315755)*(blackaid96 - 3.315755)] - [(blackaid96 - 4.995882)*(blackaid96 - 4.995882)]
		gen blackaid96prox_euclid2 = [(blackaid96 - 3.014706 )*(blackaid96 - 3.014706 )] - [(blackaid96 - 5.239089)*(blackaid96 - 5.239089)]
		gen blackaid96prox_euclid3 = [(blackaid96 - clintonblackaid96 )*(blackaid96 - clintonblackaid96 )] - [(blackaid96 - doleblackaid96) * (blackaid96 - doleblackaid96)]

	summ blackaid96prox blackaid96prox_info blackaid96prox_self blackaid96prox_euclid1 blackaid96prox_euclid2 blackaid96prox_euclid3
		

*attitude strength*
gen blackaid96ext = . 
replace blackaid96ext = 1 if blackaid96 == 4
replace blackaid96ext = 2 if blackaid96 == 3
replace blackaid96ext = 2 if blackaid96 == 5
replace blackaid96ext = 3 if blackaid96 == 6
replace blackaid96ext = 3 if blackaid96 == 2
replace blackaid96ext = 4 if blackaid96 == 1
replace blackaid96ext = 4 if blackaid96 == 7

gen blackaid96certain = . 
replace blackaid96certain = 1 if V960488 == 3
replace blackaid96certain = 2 if V960488 == 2
replace blackaid96certain = 3 if V960488 == 1
label values blackaid96certain cert

gen blackaid96imp = .
replace blackaid96imp = 1 if V960489 == 5
replace blackaid96imp = 2 if V960489 == 4
replace blackaid96imp = 3 if V960489 == 3
replace blackaid96imp = 4 if V960489 == 2
replace blackaid96imp = 5 if V960489 == 1
label values blackaid96imp imp


*standardization*


foreach var in blackaid96prox blackaid96prox_info blackaid96prox_self blackaid96prox_euclid1 blackaid96prox_euclid2 blackaid96prox_euclid3 blackaid96ext blackaid96imp blackaid96certain {
		qui sum `var'
		gen `var'01 = (`var' - `r(min)') / (`r(max)'-`r(min)')
	}
	
	
label var blackaid96prox01 "Aid Blacks:Prox"
label var blackaid96imp01 "Aid Blacks:Imp"


**abortion***
*own attitude and candidate placement*
label def abor 1 "Always able to obtain" 4 "never permitted" 
gen abortion96 = . 
replace abortion96 = 1 if V960503 == 4
replace abortion96 = 2 if V960503 == 3
replace abortion96 = 3 if V960503 == 2
replace abortion96 = 4 if V960503 == 1

gen clintonabortion96 = . 
replace clintonabortion96 = 1 if V960506 == 4
replace clintonabortion96 = 2 if V960506 == 3
replace clintonabortion96 = 3 if V960506 == 2
replace clintonabortion96 = 4 if V960506 == 1

gen doleabortion96 = . 
replace doleabortion96 = 1 if V960509 == 4
replace doleabortion96 = 2 if V960509 == 3
replace doleabortion96 = 3 if V960509 == 2
replace doleabortion96 = 4 if V960509 == 1

label values abortion96 abor
label values doleabortion96 abor
label values clintonabortion96 abor

*proximity*
	*city block: sample
		summarize doleabortion96 clintonabortion96
		*dole: 2.815977
		*clinton: 1.694372
		gen abortion96prox = abs(abortion96 - 1.694372) - abs(abortion96 - 2.815977)

	*city block; informed
			summarize doleabortion96 clintonabortion96 if knowl >=5 & knowl <= 6
		*dole: 2.879245
		*clinton:  1.412844   0
		gen abortion96prox_info = abs(abortion96 - 1.412844 ) - abs(abortion96 - 2.879245)
	*city block: self
		gen abortion96prox_self = abs(abortion96 - clintonabortion96 ) - abs(abortion96 - doleabortion96)
	*euclidean
		gen abortion96prox_euclid1 = [(abortion96 - 1.694372)*(abortion96 - 1.694372)] - [(abortion96 - 2.815977)*(abortion96 - 2.815977)]
		gen abortion96prox_euclid2 = [(abortion96 - 1.412844) *(abortion96 - 1.412844) ] - [(abortion96 - 2.879245)*(abortion96 - 2.879245)]
		gen abortion96prox_euclid3 = [(abortion96 - clintonabortion96 )*(abortion96 - clintonabortion96 )] - [(abortion96 - doleabortion96)*(abortion96 - doleabortion96)]

	summ abortion96prox abortion96prox_info abortion96prox_self abortion96prox_euclid1 abortion96prox_euclid2 abortion96prox_euclid3

*attitude strength*
gen abortion96certain = . 
replace abortion96certain = 1 if V960504 == 3
replace abortion96certain = 2 if V960504 == 2 
replace abortion96certain = 3 if V960504 == 1
label values abortion96certain abor

gen abortion96imp = . 
replace abortion96imp = 1 if V960505 == 5
replace abortion96imp = 2 if V960505 == 4
replace abortion96imp = 3 if V960505 == 3
replace abortion96imp = 4 if V960505 == 2
replace abortion96imp = 5 if V960505 == 1
label values abortion96imp imp


*standardization*

foreach var in abortion96prox abortion96prox_info abortion96prox_self abortion96prox_euclid1 abortion96prox_euclid2 abortion96prox_euclid3 abortion96imp abortion96certain {
		qui sum `var'
		gen `var'01 = (`var' - `r(min)') / (`r(max)'-`r(min)')
	}
	
	
label var abortion96prox01 "Abortion:Prox"
label var abortion96imp01 "Abortion:Imp"
	
***environment vs. jobs***
*own attitude and candidate placement*
rename V960523 enviro96
rename V960526 clintonenviro96
rename V960529 doleenviro96
mvdecode enviro96 clintonenviro96 doleenviro96, mv(0 = . \ 8 = . \ 9 = .)
label def envi 1 "Protect Environment" 7 "Proect Jobs"
label values enviro96 envi
label values clintonenviro96
label values doleenviro96


*proximity*
	*city block: sample
		summarize doleenviro96 clintonenviro96
		*clinton: 3.47093
		*dole: 4.546456
		gen enviro96prox = abs(enviro96 - 3.47093) - abs(enviro96 - 4.546456)
		
	*city block: info
		summarize doleenviro96 clintonenviro96 if knowl >=5 & knowl <=6
		*clinton: 3.119857
		*dole:  4.885553
		gen enviro96prox_info = abs(enviro96 - 3.119857) - abs(enviro96 - 4.885553)
		
	*city block: self
			gen enviro96prox_self = abs(enviro96 - clintonenviro96) - abs(enviro96 - doleenviro96)
	
	*euclid
		gen enviro96prox_euclid1 = [ (enviro96 - 3.47093)*(enviro96 - 3.47093)] - [(enviro96 - 4.546456)*(enviro96 - 4.546456)]
		gen enviro96prox_euclid2 = [ (enviro96 - 3.119857)*(enviro96 - 3.119857)] - [(enviro96 - 4.885553)*(enviro96 - 4.885553)]
		gen enviro96prox_euclid3 = [ (enviro96 - clintonenviro96)*(enviro96 - clintonenviro96)] - [(enviro96 - doleenviro96)*(enviro96 - doleenviro96)]
		
	
	summ enviro96prox enviro96prox_info enviro96prox_self enviro96prox_euclid1 enviro96prox_euclid2 enviro96prox_euclid3

*attitude strength*
gen enviro96ext = . 
replace enviro96ext = 1 if enviro96 == 4
replace enviro96ext = 2 if enviro96 == 3
replace enviro96ext = 2 if enviro96 == 5
replace enviro96ext = 3 if enviro96 == 2
replace enviro96ext = 3 if enviro96 == 6
replace enviro96ext = 4 if enviro96 == 1
replace enviro96ext = 4 if enviro96 == 7

gen enviro96certain = . 
replace enviro96certain = 1 if V960524 == 3
replace enviro96certain = 2 if V960524 == 2
replace enviro96certain = 3 if V960524 == 1
label values enviro96certain cert

gen enviro96imp = .
replace enviro96imp = 1 if V960525 == 5
replace enviro96imp = 2 if V960525 == 4
replace enviro96imp = 3 if V960525 == 3
replace enviro96imp = 4 if V960525 == 2
replace enviro96imp = 5 if V960525 == 1
label values enviro96imp imp


*standardization*


foreach var in enviro96prox enviro96prox_info enviro96prox_self enviro96prox_euclid1 enviro96prox_euclid2 enviro96prox_euclid3 enviro96imp enviro96certain enviro96ext {
		qui sum `var'
		gen `var'01 = (`var' - `r(min)') / (`r(max)'-`r(min)')
	}
	
	
label var enviro96prox01 "Enviro:Prox"
label var enviro96imp01 "Enviro:Imp"


**********Control Variables****************
**PID**
rename V960420 pid
mvdecode pid, mv(7 = . \ 8 = . \ 9 = .)
label var pid "PID"
summarize pid
gen pid01 = (pid - `r(min)') / (`r(max)'-`r(min)')
label var pid01 "PID"


**Ideology**
gen ideology =  V960365 
mvdecode ideology, mv(0 = . \ 8 = . \ 9 = .)
label var ideology "Ideology" 
summarize ideology 
gen ideology01 = (ideology - `r(min)') / (`r(max)'-`r(min)')
label var ideology01 "Ideology"

gen ideology2 = V960365
recode ideology2 (0 = 8) (9 = 8)
label var ideology2 "Ideology (Full)"
label def ideo1 8 "Haven't Thought Much/DK/NA" 1 "Ext. Liberal"  7 "Ext. Conservative" 4 "Moderate"
label values ideology2 ideo1

recode V960365 (1=1) (2=1) (3=1) (4=2) (5=3) (6=3) (7=3) ///
	(0=4) (8=4) (9=4), gen(ideol)
	
label var ideol "Ideology"
label def id 1 "Liberal" 2 "Moderate" 3 "Conservative" 4 "Haven't thought/DK/NA"
label values ideol id




**Age**
rename V960605 age
mvdecode age, mv(99 = . )
summarize age
gen age01 = (age - `r(min)') / (`r(max)'-`r(min)')
label var age01 "Age"

*- `r(min)') / (`r(max)'-`r(min)')

**Gender**
label def gend 1 "Female" 0 "Male"
gen gender = . 
replace gender = 1 if V960066 ==  2
replace gender = 0 if V960066 == 1
label values gender gend
label var gender "Gender"


**Race**
gen race = .
replace race = 1 if V960067 >=2 & V960067 <= 4
replace race = 0 if V960067 == 1
label var race "Race" 
label def ra 1 "Non-White" 0 "White"
label values race ra

gen hispanic = .
replace hispanic = 1 if V960708 == 1
replace hispanic = 0 if V960708 == 5
label var hispanic "Hispanic" 
label def his 1 "Hispanic" 0 "Not Hispanic"
label values hispanic his


**Education**

gen educ = . 
replace educ = 1 if V960610 == 1
replace educ = 1 if V960610 == 2
replace educ = 2 if V960610 == 3
replace educ = 3 if V960610 == 4
replace educ = 3 if V960610 == 5
replace educ = 4 if V960610 == 6
replace educ = 4 if V960610 == 7
label var educ "Education" 
label def ed 1 "< HS" 2 "HS" 3 "Some College" 4 "College+" 
label values educ ed


summarize educ
gen educ01 = (educ - `r(min)') / (`r(max)'-`r(min)')
label var educ01 "Education"



**Income**
rename V960701 famincome
rename V960702 income
mvdecode famincome income, mv(88 = . \ 98 = . \ 99 = .)
label var famincome "Family Income"
label var income "Own Income"

foreach var in income famincome {
		qui sum `var'
		gen `var'01 = (`var' - `r(min)') / (`r(max)'-`r(min)')

	}

label var income01 "Own Income"
label var famincome01 "Family Income"

egen income_pct = cut(income), group(10) label
gen income_miss = . 
replace income_miss = 1 if income == .
gen income_pct1 = income_pct 
replace income_pct1 = 10 if income_miss == 1 & income_pct1 == . 
label def inc_mis1 10 "Missing Income"
label values income_pct1 inc_mis1


egen famincome_pct = cut(famincome), group(10) label
gen famincome_miss = .
replace famincome_miss = 1 if famincome == . 
replace famincome_miss = 0 if famincome !=.

gen famincome_pct1 = famincome_pct 
replace famincome_pct1 = 11 if famincome_miss == 1 & famincome_pct1 == .
label def inc_mis2 10 "Missing Income" 
label values famincome_pct1 inc_mis



**Retrospective Econ Evals**
gen econ96 = .
replace econ96 = 1 if V960388 == 5
replace econ96 = 2 if V960388 == 4
replace econ96 = 3 if V960388 == 3
replace econ96 = 4 if V960388 == 2
replace econ96 = 5 if V960388 == 1
label var econ96 "Economic Evals"

summarize econ96
gen econ01 = (econ96 - `r(min)') / (`r(max)'-`r(min)')
label var econ01 "Economic Eval"


**Candidate Traits**
label def trai 1 "Not Well at All" 4 "Extremely Well"
gen clinton96moral = . 
replace clinton96moral = 1 if V960423 == 4
replace clinton96moral = 2 if V960423 == 3
replace clinton96moral = 3 if V960423 == 2
replace clinton96moral = 4 if V960423 == 1
gen clinton96knowl = .
replace clinton96knowl = 1  if V960428 == 4
replace clinton96knowl = 2  if V960428 == 3
replace clinton96knowl = 3  if V960428 == 2
replace clinton96knowl = 4  if V960428 == 1
gen clinton96leader = . 
replace clinton96leader = 1 if V960426 == 4
replace clinton96leader = 2 if V960426 == 3
replace clinton96leader = 3 if V960426 == 2
replace clinton96leader = 4 if V960426 == 1

label values clinton96moral trai
label values clinton96knowl trai
label values clinton96leader trai

gen dole96moral = . 
replace dole96moral = 1 if V960432 == 4
replace dole96moral = 2 if V960432 == 3
replace dole96moral = 3 if V960432 == 2
replace dole96moral = 4 if V960432 == 1
gen dole96knowl = . 
replace dole96knowl = 1 if V960437 == 4
replace dole96knowl = 2 if V960437 == 3
replace dole96knowl = 3 if V960437 == 2
replace dole96knowl = 4 if V960437 == 1
gen dole96leader =  . 
replace dole96leader = 1 if V960435 == 4
replace dole96leader = 2 if V960435 == 3
replace dole96leader = 3 if V960435 == 2
replace dole96leader = 4 if V960435 == 1

label values dole96leader trai
label values dole96moral trai
label values dole96knowl trai

*Comparative Traits*
gen moral96 = dole96moral - clinton96moral
gen knowl96 = dole96knowl - clinton96knowl
gen leader96 = dole96leader - clinton96leader

foreach var in  moral96 knowl96 leader96 {
		qui sum `var'
		gen `var'01 = (`var' - `r(min)') / (`r(max)'-`r(min)')
	}
